﻿<h1>Hello World!</h1>

@Html.ActionLink("Boom!", "Boom")
@Html.ActionLink("Custom Boom!", "CustomBoom")
@Html.ActionLink("Boom 25!", "Boom25")
@Html.ActionLink("Manual Stacking", "ManualStacking", new { myId = "123456789" })

<a href="javascript:doAjax()">Ajax Boom</a>

<a href="javascript:doHugeAjax()">Huge Ajax Boom</a>

<a href="javascript:doApiAjax()">Api GET Boom</a>

<a href="javascript:doApiPostAjax()">Api POST Boom</a>

@using (Html.BeginForm("CreateRequestValidationException", "Home", FormMethod.Post)) { 
    @Html.Hidden("value", "&#134") 
    <input type="submit" class="btn btn-primary" value="Create HttpRequestValidationException" /> 
}

@using (Html.BeginForm("Index", "Home", FormMethod.Post)) { 
    @Html.Hidden("Test", "test value") 
    @Html.Hidden("Blah", "blah value") 
    <input type="submit" class="btn btn-primary" value="Form Boom" /> 
}

<script type="text/javascript">
    function doAjax() {
        $.ajax({
            type: "POST",
            url: "/Home/AjaxMethod",
            data: JSON.stringify({ Test: 'test value', Blah: 'blah value' }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }
    
    function doHugeAjax() {
        var data = repeat('01234567890', 5000);
        $.ajax({
            type: "POST",
            url: "/Home/AjaxMethod",
            data: JSON.stringify({ Test: data, Blah: 'blah value' }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }
    
    function repeat(str, num) {
        return (new Array(num + 1)).join(str);
    }

    function doApiAjax() {
        $.ajax({
            type: "GET",
            url: "/api/values",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }

    function doApiPostAjax() {
        $.ajax({
            type: "POST",
            url: "/api/values",
            data: JSON.stringify({ Name: "Test" }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }
</script>